import React, { useState, useEffect, useRef } from 'react'; import { Instagram, Youtube, Twitter, Github, Facebook, Link as LinkIcon, User, Edit3, Plus, Trash2, Image as ImageIcon, ExternalLink, ChevronRight, Settings, Eye, Save, MoreVertical, Upload, Camera } from 'lucide-react'; // SNS Icons Map const SNS_ICONS = { instagram: Instagram, youtube: Youtube, twitter: Twitter, github: Github, facebook: Facebook, }; const App = () => { // --- State --- const [isAdmin, setIsAdmin] = useState(true); const [profile, setProfile] = useState({ name: '김테크', bio: '프론트엔드 개발자 | 일상의 기록을 공유합니다.', avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?q=80&w=200&h=200&auto=format&fit=crop' }); const [snsLinks, setSnsLinks] = useState([ { platform: 'instagram', url: 'https://instagram.com', active: true }, { platform: 'youtube', url: 'https://youtube.com', active: true }, { platform: 'github', url: 'https://github.com', active: true }, ]); const [links, setLinks] = useState([ { id: 1, title: '나의 포트폴리오', description: '그동안 진행했던 프로젝트들을 확인해보세요.', url: 'https://portfolio.com', image: 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?q=80&w=100&h=100&auto=format&fit=crop' }, { id: 2, title: '최신 블로그 포스트', description: 'React와 Tailwind CSS를 활용한 UI 디자인 방법', url: 'https://blog.com', image: 'https://images.unsplash.com/photo-1498050108023-c5249f4df085?q=80&w=100&h=100&auto=format&fit=crop' } ]); const fileInputRef = useRef(null); // --- Actions --- const handleImageUpload = (e) => { const file = e.target.files[0]; if (file) { const reader = new FileReader(); reader.onloadend = () => { setProfile({ ...profile, avatar: reader.result }); }; reader.readAsDataURL(file); } }; const addLink = () => { const newLink = { id: Date.now(), title: '새로운 링크', description: '설명을 입력해주세요.', url: 'https://', image: '' }; setLinks([newLink, ...links]); }; const updateLink = (id, field, value) => { setLinks(links.map(link => link.id === id ? { ...link, [field]: value } : link)); }; const deleteLink = (id) => { setLinks(links.filter(link => link.id !== id)); }; const updateSns = (platform, url) => { setSnsLinks(snsLinks.map(s => s.platform === platform ? { ...s, url } : s)); }; return (
{/* Header */}
MyLink
{/* Main Content */}
{isAdmin ? ( /* Admin Panel */

프로필 설정

{/* Avatar Upload UI */}
fileInputRef.current?.click()}>
avatar { e.currentTarget.src = 'https://via.placeholder.com/150'; }} />

사진 파일을 선택하여 프로필 이미지를 변경하세요.

setProfile({...profile, name: e.target.value})} />